package com.flyxiaozhu.erp.core.entities;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.hibernate.annotations.*;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;
import java.util.List;

/**
 * @author flyxiaozhu
 * @date 2019-04-12 0:15
 */
@Entity
@Data
@DynamicInsert
@DynamicUpdate
public class GoodsCategory extends BaseEntity {
    @Column(columnDefinition = "varchar(32) not null default '' comment '分类名称'")
    private String name;

    @Column(columnDefinition = "int(11) not null default 0 comment '父分类ID'")
    private long pid;

    @Column(columnDefinition = "tinyint(2) not null default 0 comment '状态'")
    private int status;

    @Column(columnDefinition = "tinyint(2) not null default 1 comment '栏目级别，1 一级栏目'")
    private int level;

    @Column(columnDefinition = "TIMESTAMP COMMENT '更新时间'")
    private String updateTime;

    @Transient
    @JsonIgnore
    private GoodsCategory parent;

    @Transient
    private List<GoodsCategory> children;
}
